/*
    created: 2023/4/29  
    filename: Maintree.c
    author: 李东霖
    purpose: 二叉树代码的测试
*/

#include"treelist.h"

int main()
{
    char str[] = "A(B(D(,G)),C(E,F))";

    BTree tree = NULL;
    CreateBTree(&tree,str);
    DispTree(tree);
    ElemType elem = 'C';
    BTNode* p = FindNode(tree,&elem);
    if(p != NULL) printf("\n%c\n",p->data);
    int h = TreeHight(tree);
    printf("H = %d\n",h);
    BTNode* l = LchildNode(tree);
    BTNode* r = RchildNode(tree->rchild);
    if(l != NULL && r != NULL) printf("L==%c  R==%c\n",l->data,r->data);

    //层次遍历  
    LevelOrder(tree);
    printf("\n");
    //先序遍历 
    PreOrder(tree);
    printf("\n"); 
    //中序遍历
    InOrder(tree);
    printf("\n");
    //后序遍历
    PostOrder(tree);

}